package cn.itrip.biz.controller;

import cn.itrip.beans.dto.Dto;
import cn.itrip.beans.vo.AreaDicVO;
import cn.itrip.biz.service.HotelService;
import cn.itrip.utlis.DtoUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description : 类描述
 * Created by Li on 2020-12-23 11:44:17
 */
@RestController
@RequestMapping("/api/hotel")
@Api
public class HotelController {
    @Autowired
    private HotelService hotelService;

    @GetMapping("/queryhotcity/{isChina}")
    @ApiOperation(value = "根据类别查询热门城市",httpMethod = "GET", response = Dto.class,
    notes = "9999")
    public Dto queryHotCity(@ApiParam(required = true, value = "1国内, 2国外", name = "isChina")
            @PathVariable Integer isChina) {
        return DtoUtil.returnDataSuccess(hotelService.queryHotCity(isChina));
    }

    @GetMapping("/querytradearea/{parentId}")
    public Dto queryTradeArea(@PathVariable Integer parentId){
        List<AreaDicVO> list = hotelService.queryTradeArea(parentId);
        return DtoUtil.returnDataSuccess(list);
    }
}
